﻿@model IEnumerable<HanGu.Entity.MemberContract>
@{
    Layout = null;
    int i = 1;
    ViewBag.ViewTitle = "客户合同信息";
    var Parents = ViewData["Parents"] as SelectList;
    var action = Request["action"];
    var read = action != null && action == "read";
    decimal Total = 0;
}
<div class="pageContent">
    <script>
        function mydialogAjaxDone(json) {
            DWZ.ajaxDone(json);
            if (json.statusCode == DWZ.statusCode.ok) {
                if (json.navTabId) {
                    var $this = $("#" + json.navTabId);
                    $this.loadUrl($this.attr("ref"));
                } else if (json.rel) {
                    navTabPageBreak({}, json.rel);
                }
                if ("closeCurrent" == json.callbackType) {
                    $.pdialog.closeCurrent();
                }
            }
        }
        
    </script>
    @if (!read)
    {
        <div class="panelBar">
            <ul class="toolBar">
                <li><a class="add" href="CustomerInfo/MemberContract/create/0/@ViewData["ParentID"]" target="dialog" width="800" height="500" title="添加-@ViewBag.ViewTitle">
                    <span>添加</span></a></li>
            </ul>
        </div>
    }
    <table class="table" width="100%">
        <thead>
            <tr class="header">
                <th>
                    序号
                </th>
                <th>
                    日期
                </th>
                <th>
                    金额
                </th>
               @* <th>
                    负责人
                </th>*@
                <th>
                    内容
                </th>
                <th>
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            Total += item.Amount;        
            <tr target="CustomerGroup_id" rel="@item.ID" >
                <td>
                    @i
                </td>
                <td>
                    <span formatdate="yyyy-MM-dd">
                        @item.StarDate
                    </span>
                </td>
                <td>
                    @item.Amount
                </td>
                @*<td>                 
                    @item.Creator
                </td>*@
                <td>
                    <div title="@item.Remark">
                        @item.Remark
                    </div>
                </td>
                <td>
                    @if (!read)
                    {
                        <a class="" href="CustomerInfo/MemberContract/create/@item.ID/@ViewData["ParentID"]?action=edit" target="dialog"  width="800" height="500" title="修改-@ViewBag.ViewTitle">
                            <span>修改</span></a> <span>&nbsp;</span> <a class="" href="CustomerInfo/MemberContract/Delete/@item.ID/@item.ParentID" callback="mydialogAjaxDone" target="ajaxTodo" title="确定要删除吗？">
                                <span>删除</span></a>
                    }
                </td>
            </tr>
                    i += 1;
        }
        @if (Model.Count() > 0)
        {
        <tr>
            <td>
            </td>
            <td style=" text-align:right;">
                总额:
            </td>
            <td>
                @Total
            </td>
            <td>
            数量： @(i-1)
            </td>
            <td>
           
            </td>
            <td>
            </td>
        </tr>
        }
    </table>
</div>
